home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1997
/
HAM Radio 1997.iso
/
vbxs
/
crwvbx02
/
publishr.frm
< prev
next >
Wrap
Text File
|
1996-04-08
|
13KB
|
453 lines
VERSION 2.00
Begin Form frmPublishers
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "Publishers"
ClientHeight = 3504
ClientLeft = 2004
ClientTop = 2592
ClientWidth = 6516
Height = 3948
Icon = PUBLISHR.FRX:0000
Left = 1944
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3504
ScaleWidth = 6516
Top = 2208
Width = 6636
Begin Data Data1
Caption = "Data1 - BIBLIO.MDB - Publishers"
Connect = ""
DatabaseName = "C:\VB\VBPRO3\BIBLIO.MDB"
Exclusive = 0 'False
Height = 252
Left = 48
Options = 0
ReadOnly = 0 'False
RecordSource = "Publishers"
Top = 2772
Visible = 0 'False
Width = 4020
End
Begin SSPanel pnlSelect
BevelInner = 1 'Inset
BorderWidth = 1
Height = 684
Left = 180
TabIndex = 0
Top = 150
Width = 6156
Begin SSPanel pnlShortName
BevelOuter = 0 'None
Height = 540
Left = 3036
TabIndex = 25
Top = 60
Width = 3060
Begin TextBox txtShortName
DataField = "Name"
DataSource = "Data1"
Height = 288
Left = 72
TabIndex = 3
Top = 144
Width = 2868
End
End
Begin ComboBox cmboPubIndex
Height = 288
Left = 1596
Style = 2 'Dropdown List
TabIndex = 2
Top = 204
Width = 1404
End
Begin Label lblIndex
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Publisher &Index"
ForeColor = &H00800000&
Height = 240
Left = 144
TabIndex = 1
Top = 252
Width = 1428
End
End
Begin SSPanel pnlMaster
BevelInner = 1 'Inset
BorderWidth = 1
Height = 1944
Left = 180
TabIndex = 4
Top = 960
Width = 6156
Begin TextBox txtInfo
DataField = "Zip"
DataSource = "Data1"
Height = 288
Index = 4
Left = 4800
TabIndex = 12
Top = 792
Width = 1068
End
Begin TextBox txtInfo
DataField = "State"
DataSource = "Data1"
Height = 288
Index = 3
Left = 4296
TabIndex = 11
Top = 792
Width = 468
End
Begin TextBox txtInfo
DataField = "Fax"
DataSource = "Data1"
Height = 288
Index = 6
Left = 1800
TabIndex = 16
Top = 1440
Width = 1350
End
Begin TextBox txtInfo
DataField = "Telephone"
DataSource = "Data1"
Height = 288
Index = 5
Left = 1800
TabIndex = 14
Top = 1116
Width = 1350
End
Begin TextBox txtInfo
DataField = "City"
DataSource = "Data1"
Height = 288
Index = 2
Left = 1800
TabIndex = 10
Top = 792
Width = 2460
End
Begin TextBox txtInfo
DataField = "Address"
DataSource = "Data1"
Height = 288
Index = 1
Left = 1800
TabIndex = 8
Top = 468
Width = 4070
End
Begin TextBox txtInfo
DataField = "Company Name"
DataSource = "Data1"
Height = 288
Index = 0
Left = 1800
TabIndex = 6
Top = 144
Width = 4070
End
Begin Label lblInfo
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "&FAX Number"
ForeColor = &H00800000&
Height = 288
Index = 4
Left = 216
TabIndex = 15
Top = 1440
Width = 1500
End
Begin Label lblInfo
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Phone &Number"
ForeColor = &H00800000&
Height = 288
Index = 3
Left = 216
TabIndex = 13
Top = 1116
Width = 1500
End
Begin Label lblInfo
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "&City, State ZIP"
ForeColor = &H00800000&
Height = 288
Index = 2
Left = 216
TabIndex = 9
Top = 792
Width = 1500
End
Begin Label lblInfo
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "&Address"
ForeColor = &H00800000&
Height = 288
Index = 1
Left = 216
TabIndex = 7
Top = 468
Width = 1500
End
Begin Label lblInfo
Alignment = 1 'Right Justify
BackColor = &H00C0C0C0&
Caption = "Company &Name"
ForeColor = &H00800000&
Height = 288
Index = 0
Left = 216
TabIndex = 5
Top = 144
Width = 1500
End
End
Begin SSPanel pnlAction
Align = 2 'Align Bottom
Height = 420
Left = 0
TabIndex = 17
Top = 3084
Width = 6516
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&E&xit"
Height = 400
Index = 6
Left = 5568
TabIndex = 24
Top = 12
Width = 920
End
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&Print"
Height = 400
Index = 5
Left = 4644
TabIndex = 23
Top = 12
Width = 920
End
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&Save"
Enabled = 0 'False
Height = 400
Index = 4
Left = 3720
TabIndex = 22
Top = 12
Width = 920
End
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&Cancel"
Enabled = 0 'False
Height = 400
Index = 3
Left = 2796
TabIndex = 21
Top = 12
Width = 920
End
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&Edit"
Height = 400
Index = 2
Left = 1872
TabIndex = 20
Top = 12
Width = 920
End
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&Delete"
Height = 400
Index = 1
Left = 948
TabIndex = 19
Top = 12
Width = 920
End
Begin SSCommand cmdAction
BevelWidth = 1
Caption = "&New"
Height = 400
Index = 0
Left = 24
TabIndex = 18
Top = 12
Width = 920
End
End
End
Option Explicit
DefInt A-Z
Sub ActionToggle (EditStatus As Integer)
pnlMaster.Enabled = EditStatus
pnlShortName.Enabled = EditStatus
cmboPubIndex.Enabled = Not EditStatus
cmdAction(0).Enabled = Not EditStatus
cmdAction(1).Enabled = Not EditStatus
cmdAction(2).Enabled = Not EditStatus
cmdAction(3).Enabled = EditStatus
cmdAction(4).Enabled = EditStatus
cmdAction(5).Enabled = Not EditStatus
cmdAction(6).Enabled = Not EditStatus
End Sub
Sub cmboPubIndex_Click ()
Data1.Recordset.FindFirst "[PubID] = " & cmboPubIndex
End Sub
'
' This routine is usually the hub of my programs. I've standardized on
' the toolbar buttons named 'cmdAction'. It makes it easier for others
' to follow behind me later (myself included). We always know where the
' 'central control' routine is located.
'
' I normally use Sheridan bound Combo boxes and don't have to update the
' ListIndex property. This was the first time I had to do the extra
' coding to maintain the Combo, and there may be a better way.
'
Sub cmdAction_Click (Index As Integer)
Static NewRecordInProgress As Integer
Dim Temp As Long
Select Case Index
Case 0 'Add New Record
Call ActionToggle(True)
BeginTrans
Data1.Recordset.MoveLast
Temp = Data1.Recordset("PubId") + 1
cmboPubIndex.AddItem Trim$(Str$(Temp))
cmboPubIndex.ListIndex = Data1.Recordset.RecordCount
Data1.Recordset.AddNew
Data1.Recordset("PubID") = Temp
NewRecordInProgress = True
Case 1 'Delete Current Record
BeginTrans
If VerifyDeleteRecord() Then
Data1.Recordset.Delete
Temp = cmboPubIndex.ListIndex
cmboPubIndex.RemoveItem cmboPubIndex.ListIndex
If Temp <= cmboPubIndex.ListCount - 1 Then
cmboPubIndex.ListIndex = Temp
Else
cmboPubIndex.ListIndex = Temp - 1
End If
Call cmdAction_Click(4)
End If
Case 2 'Edit Current Record
Call ActionToggle(True)
BeginTrans
Case 3 'Cancel current operation
Call ActionToggle(False)
Rollback
If NewRecordInProgress Then
cmboPubIndex.RemoveItem cmboPubIndex.ListIndex
NewRecordInProgress = False
End If
Data1.Refresh
cmboPubIndex.ListIndex = 0
Case 4 'Commit current operation
Call ActionToggle(False)
Data1.UpdateRecord
CommitTrans
If NewRecordInProgress Then
Data1.Recordset.MoveLast
cmboPubIndex.ListIndex = cmboPubIndex.ListCount - 1
NewRecordInProgress = False
End If
Case 5 'Print a report
Call PrintReport
Case 6 'Terminate program
Call ProgramShutDown
Case Else
End Select
End Sub
Sub Form_Activate ()
Call ActionToggle(False)
Call LoadPublisherCombo
End Sub
Sub Form_Load ()
Dim rc As Integer
On Local Error GoTo frmPublisherLoadError
Call InitFormDataControls(Me)
Call CenterForm(Me)
Exit Sub
frmPublisherLoadError:
rc = CriticalErrorHandler(Err)
Exit Sub
End Sub
Sub LoadPublisherCombo ()
'get the list of Publishers for the dropdown combo
'Dim ds As Dynaset
Data1.Refresh
Set ds = Data1.Recordset.CreateDynaset()
ds.MoveLast
ds.MoveFirst
If ds.RecordCount > 0 Then
Do
cmboPubIndex.AddItem ds("PubID")
ds.MoveNext
Loop Until ds.EOF
End If
cmboPubIndex.ListIndex = 0
ds.Close
End Sub
Sub PrintReport ()
'ds is a global DynaSet
Screen.MousePointer = HOURGLASS
Set ds = Data1.Recordset.CreateDynaset()
frmPrinter.Show MODAL
End Sub